package com.whales.lms.rms.web.controller;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.whales.lms.rms.scheduler.service.IFService;
import com.whales.shared.util.XmlUtil;

@Controller
@RequestMapping("/if/*")
public class IFController {
	@Inject
	private IFService ifService;

	@RequestMapping
	public @ResponseBody String getMacAddress(String ip) throws Exception{
		return ifService.sendXml(ip, XmlUtil.buildDocForServerCommand("MAC"), "value");
	}
	
	@RequestMapping
	public @ResponseBody String pcAllOff() throws Exception{
		return ifService.pcAllOff();
	}
	
	@RequestMapping
	public @ResponseBody String pcAllOn() throws Exception{
		return ifService.pcAllOn();
	}
	
	@RequestMapping
	public @ResponseBody String pcOff(String ip) throws Exception{
		return ifService.pcOff(ip);
	}
	
	@RequestMapping
	public @ResponseBody String pcOn(String ip, String macAddress) throws Exception{
		return ifService.pcOn(ip, macAddress);
	}
	
	@RequestMapping
	public @ResponseBody String pcRestart(String ip) throws Exception{
		return ifService.pcRestart(ip);
	}
	
	@RequestMapping
	public @ResponseBody String projectorOn(String ip) throws Exception{
		return ifService.projectorOn(ip);
	}
	
	@RequestMapping
	public @ResponseBody String projectorOff(String ip) throws Exception{
		return ifService.projectorOff(ip);
	}
	
	@RequestMapping
	public @ResponseBody String ping(String ip) throws Exception{
		return ifService.ping(ip);
	}
	
	@RequestMapping
	public @ResponseBody String softwareRestart(String ip) throws Exception{
		return ifService.softwareRestart(ip);
	}
	
	@RequestMapping
	public @ResponseBody String softwareVersionUpdate(String ip) throws Exception{
		return ifService.softwareVersionUpdate(ip);
	}
	
	@RequestMapping
	public @ResponseBody String agentUpdate(String ip) throws Exception{
		return ifService.agentUpdate(ip);
	}
	
	@RequestMapping
	public @ResponseBody String agentAlive(String ip) throws Exception{
		return ifService.agentAlive(ip);
	}
}
